Function newRPGfile:Int(templatefile:String, newrpg:String) as integer
	Local newRPGfile:Int = 0 ' default return value 0 means failure
	If newrpg = "" Then Return 0
	'textcolor uilook(uiSelectedDisabled), 0
	'printstr "Please Wait...", 0, 40, vpage
	'printstr "Creating RPG File", 0, 50, vpage
	'setvispage vpage
	If Not FileType(templatefile) = 1 Then
	 'printstr "Error: ohrrpgce.new not found", 0, 60, vpage
	 'printstr "Press Enter to quit", 0, 70, vpage
	 'setvispage vpage
	 'waitforanykey
	 Return 0
	End If
	CopyFile(templatefile, newrpg+".rpg")
	'printstr "Unlumping", 0, 60, vpage
	'setvispage vpage 'refresh
	
	'unlump newrpg, workingdir + SLASH
	
	'--create archinym information lump
	Local fh:Int = 0'FREEFILE <-- find declare
	'OPEN workingdir + SLASH + "archinym.lmp" For OUTPUT AS #fh
	'Print #fh, "ohrrpgce"
	'Print #fh, version
	'CLOSE #fh
	'printstr "Finalumping", 0, 80, vpage
	'setvispage vpage 'refresh
	'--re-lump files as NEW rpg file
	
	'dolumpfiles newrpg
	
	
	Return 1'newRPGfile = -1 'return true for success
End Function
